//
//  StaticData.h
//  捕鱼达人练习例子
//
//  Created by 杜 甲 on 13-7-4.
//
//

#ifndef ____________StaticData__
#define ____________StaticData__

#include "cocos2d.h"
USING_NS_CC;
using namespace std;
#define STATIC_DATA_STRING(key) StaticData::sharedStaticData()->stringFormKey(key)
#define STATIC_DATA_INT(key)   StaticData::sharedStaticData()->intFromKey(key)
#define STATIC_DATA_FLOAT(key) StaticData::sharedStaticData()->floatFromKey(key)
#define STATIC_DATA_BOOLEAN(key) StaticData::sharedStaticData()->booleanFromKey(key)
#define STATIC_DATA_POINT(key)   StaticData::sharedStaticData()->pointFromKey(key)
#define STATIC_DATA_RECT(key)    StaticData::sharedStaticData()->rectFromKey(key)
#define STATIC_DATA_SIZE(key)   StaticData::sharedStaticData()->sizeFromKey(key)

class StaticData:public CCObject
{
    
public:
    //单例的初始化方法
    static StaticData* sharedStaticData();
    
    const char* stringFormKey(string key);
    int intFromKey(string key);
    float floatFromKey(string key);
    bool booleanFromKey(string key);
    CCPoint pointFromKey(string key);
    CCRect rectFromKey(string key);
    CCSize sizeFromKey(string key);
    
    
    //内存不足时调用
    void purge();
    
    CC_SYNTHESIZE_READONLY(string, _staticDataPath, StaticDataPath);
protected:
    CCDictionary* _dictionary;
private:
    //该数据模型的构造方法
    StaticData();
    //该数据模型的析构方法
    ~StaticData();
    bool init();
};




#endif /* defined(____________StaticData__) */
